package top.wshape1.rpc.config;

import lombok.Data;
import top.wshape1.rpc.common.constant.FaultTolerantEnum;
import top.wshape1.rpc.common.constant.LoadBalanceType;

/**
 * @author Wshape1
 * @version 1.0
 * @description
 * @since 2024-02-10
 */

@Data
public class ConsumerConfig {

    private boolean enabled;

    /**
     * 调用远程服务超时时间 单位ms
     */
    private int callTimeout = 3000;

    private String loadBalance = LoadBalanceType.round_robin.name();

    private FaultTolerantConfig faultTolerant = new FaultTolerantConfig();

    @Data
    public static class FaultTolerantConfig {
        private String strategy = FaultTolerantEnum.failback.name();

        /**
         * 重试次数
         */
        private int retryTimes = 3;

        /**
         * 重试间隔 单位ms
         */
        private int retryInterval = 1000;

    }

}
